home *** CD-ROM | disk | FTP | other *** search
- Path: galaxy.ucr.edu!not-for-mail
- From: thp@cs.ucr.edu (Tom Payne)
- Newsgroups: comp.lang.c++,comp.lang.java
- Subject: Re: Java: What's the Big Deal?
- Followup-To: comp.lang.c++,comp.lang.java
- Date: 17 Mar 1996 20:55:26 GMT
- Organization: University of California, Riverside
- Message-ID: <4ihu7u$ogn@galaxy.ucr.edu>
- References: <4i40ik$9dt@news4.digex.net> <milodDo5yDE.H8B@netcom.com> <4if9jc$rkm@druid.borland.com> <milodDoF9JF.K32@netcom.com>
- NNTP-Posting-Host: corvette.ucr.edu
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- John DiCamillo (milod@netcom.com) wrote:
- : pete@borland.com (Pete Becker) writes:
- :
- : >There's no reason you can't write a C++ compiler that generates a Java
- : >bytestream.
- :
- : Are you claiming that arbitrary, correct (ANSI) C++ code can
- : be compiled to the JVM and continue to work correctly? Or are
- : you claiming that a compiler can be written that will translate
- : some limited subset of C++ into JVM?
- :
- : And even if it is the former, given the limitations of the JVM,
- : I suspect that the performance characteristics of the resulting
- : program might be unrecognizable to the author.
-
- There is no fundamental reason that g++, for instance, couldn't be
- targeted to JVM, just as it has been targeted to so many other
- architectures. There may be some design features of JVM that make
- code generated for the non-Java features of C++ (e.g., pointers)
- particularly inefficient, but typically anything up to 10-to-1
- degredation is considered normal for such emulation.
-
- : >>Other merely practical advantages (for certain kinds of apps)
- : >>include:
- : >>
- : >>1) Trade speed for safety (no pointer arithmetic + GC +
- : >> all casts dynamically checked + array bounds + ...)
- : >> This makes it a bit easier to program in than C++.
- :
- : >Huh? Why can't you make these tradeoffs in C++? In fact, the problem is just
- : >the opposite: you can't make these tradeoffs in Java because it does not let
- : >you use pointers or handle your own memory management. This means you cannot
- : >decide that speed is more important than safety.
- :
- : Right, which was exactly my point. The tradeoff has already
- : been made by the language in the right direction for certain
- : kinds of apps. Thus, there is less work for the programmer,
- : *assuming that you agree with the tradeoff*.
-
- For C++ these are (mostly) implementation issues rather than language
- features. Any implementation of C++ is free to make such tradeoffs,
- e.g., to include bounds checking, a garbage collector, etc.
-
- : >>2) No header files => faster compilation
- :
- : >Nonsense. Header files are simply text that gets included where you want it. If
- : >you write the same code without header files it will not magically compile
- : >faster.
- :
- : It's not nonsense. Cascaded #includes result in such a
- : drastic inflation of the source text that it makes a measurable
- : increase in compilation time.
-
- That is an argument against using header files, or at least against
- using them in certain ways --- ways that are perhaps too common
- (but not directly required) in C++.
-
-
- In essence, Java is a P-code implementation of a (carefully chosen)
- subset of C++ with some librarys added. It may be a major step
- forward in implementation and may point the way to a better
- programming style (e.g., pointerless).
-
- I'm very interested in the issue of just how satisfied programmers are
- with the expressiveness of Java, because being able to start freshmen
- with an interpreted implementation of a standardized, expressive,
- small subset of C++ (augmented with GC and bounds checking) is likely
- to make life easier both for them and for me. I doubt, however, that
- I would select Java for a data structures class.
-
- Tom Payne (thp@cs.ucr.edu)
-